<?php
//
// +---------------------------------------------------------------------------------+
// | Package: EezeeSite Core                                                         |
// +---------------------------------------------------------------------------------+
// | Copyright (C) 2006  EezeeSite Development Team                                  |
// +---------------------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or                   |
// | modify it under the terms of the GNU General Public License                     |
// | as published by the Free Software Foundation; either version 2                  |
// | of the License, or (at your option) any later version.                          |
// |                                                                                 |
// | This program is distributed in the hope that it will be useful,                 |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of                  |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                   |
// | GNU General Public License for more details.                                    |
// |                                                                                 |
// | You should have received a copy of the GNU General Public License               |
// | along with this program; if not, write to the Free Software                     |
// | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA. |
// +---------------------------------------------------------------------------------+
// | Author: Mayukh De <mayukhde@gmail.com>                                          |
// +---------------------------------------------------------------------------------+
//

//db config variables

define('ES_PAGES_TBL', ES_TBL_PRE.'pages');
define('ES_USERS_TBL', ES_TBL_PRE.'users');
define('ES_USERSXTRAINFO_TBL', ES_TBL_PRE.'users_extra_info');
define('ES_INVITES_TBL', ES_TBL_PRE.'invites');
define('ES_APPS_TBL', ES_TBL_PRE.ES_LU_PRE.'applications');
define('ES_GROUPS_TBL', ES_TBL_PRE.ES_LU_PRE.'groups');
define('ES_GROUPUSERS_TBL', ES_TBL_PRE.ES_LU_PRE.'groupusers');
define('ES_GROUPRIGHTS_TBL', ES_TBL_PRE.ES_LU_PRE.'grouprights');
define('ES_AREAS_TBL', ES_TBL_PRE.ES_LU_PRE.'areas');
define('ES_PERMUSERS_TBL', ES_TBL_PRE.ES_LU_PRE.'perm_users');
define('ES_RIGHTS_TBL', ES_TBL_PRE.ES_LU_PRE.'rights');
define('ES_USERRIGHTS_TBL', ES_TBL_PRE.ES_LU_PRE.'userrights');

$DBSchemaConfigs['TABLES'] = array(
                                  ES_USERS_TBL,
                                  ES_USERSXTRAINFO_TBL,
                                  ES_INVITES_TBL,
                                  ES_PAGES_TBL,
                                  ES_APPS_TBL,
                                  ES_AREAS_TBL,
                                  ES_RIGHTS_TBL,
                                  ES_PERMUSERS_TBL,
                                  ES_GROUPS_TBL,
                                  ES_GROUPUSERS_TBL,
                                  ES_USERRIGHTS_TBL,
                                  ES_GROUPRIGHTS_TBL
                                  );

$DBSchemaConfigs['PROPERTIES'][ES_USERS_TBL] = array(
                                                    'user_id'    => array(
                                                                         'type'     => 'integer',
                                                                         'default'  => 1,
                                                                         'require'  => true
                                                                         ),
                                                    'handle'     => array(
                                                                         'type'    => 'varchar',
                                                                         'size'    => 32
                                                                         ),
                                                    'email'      => array(
                                                                         'type'    => 'varchar',
                                                                         'size'    => 64,
                                                                         'require' => true
                                                                         ),
                                                    'password'   => array(
                                                                         'type'    => 'varchar',
                                                                         'size'    => 32,
                                                                         'require' => true
                                                                         ),
                                                    'lastaccess' => array(
                                                                         'type'    => 'timestamp'
                                                                         ),
                                                    'lastcookie' => array(
                                                                         'type'    => 'varchar',
                                                                         'size'    => 32
                                                                         ),
                                                    'lastip'     => array(
                                                                         'type'    => 'varchar',
                                                                         'size'    => 32
                                                                         ),
                                                    'is_active'  => array(
                                                                         'type'    => 'boolean',
                                                                         'require' => true,
                                                                         'default' => 1
                                                                         ),
                                                    'user_group' => array(
                                                                         'type'    => 'integer',
                                                                         'require' => true
                                                                         )
                                                    );
$DBSchemaConfigs['INDEX'][ES_USERS_TBL]      = array(
                                                    'user_id' => array(
                                                                      'type' => 'unique',
                                                                      'cols' => 'user_id'
                                                                      )
                                                    );
                                                    
$DBSchemaConfigs['PROPERTIES'][ES_USERSXTRAINFO_TBL] = array(
                                                            'user_id'    => array(
                                                                                 'type'    => 'integer',
                                                                                 'default' => 1,
                                                                                 'require' => true
                                                                                 ),
                                                            'dob'        => array(
                                                                                 'type'    => 'timestamp'
                                                                                 ),
                                                            'signupdate' => array(
                                                                                 'type'    => 'timestamp'
                                                                                 ),
                                                            'fname'      => array(
                                                                                 'type'    => 'varchar',
                                                                                 'size'    => 32
                                                                                 ),
                                                            'lname'      => array(
                                                                                 'type'    => 'varchar',
                                                                                 'size'    => 32
                                                                                 ),
                                                            'occupation' => array(
                                                                                 'type'    => 'varchar',
                                                                                 'size'    => 128
                                                                                 ),
                                                            'location'   => array(
                                                                                 'type'    => 'varchar',
                                                                                 'size'    => 128
                                                                                 ),
                                                            'bio'        => array(
                                                                                 'type'    => 'clob'
                                                                                 ),
                                                            'updates'    => array(
                                                                                 'type'    => 'boolean',
                                                                                 'require' => true
                                                                                 ),
                                                            'lastupdate' => array(
                                                                                 'type'    => 'timestamp'
                                                                                 ),
                                                            'searchable' => array(
                                                                                 'type'    => 'boolean',
                                                                                 'require' => true
                                                                                 )
                                                            );
$DBSchemaConfigs['INDEX'][ES_USERSXTRAINFO_TBL]      = array(
                                                            'user_id' => array(
                                                                              'type' => 'unique',
                                                                              'cols' => 'user_id'
                                                                              )
                                                            );
                                                            
$DBSchemaConfigs['PROPERTIES'][ES_INVITES_TBL] = array(
                                                      'invite_id'    => array(
                                                                             'type'    => 'integer',
                                                                             'default' => 1,
                                                                             'require' => true
                                                                             ),
                                                      'user_id'      => array(
                                                                             'type'    => 'integer',
                                                                             'default' => 1,
                                                                             'require' => true
                                                                             ),
                                                      'invite_email' => array(
                                                                             'type'    => 'varchar',
                                                                             'size'    => 64,
                                                                             'require' => true
                                                                             ),
                                                      'invite_date'  => array(
                                                                             'type'    => 'timestamp'
                                                                             ),
                                                      'accept_date'  => array(
                                                                             'type'    => 'timestamp'
                                                                             )                                                                                               
                                                      );
$DBSchemaConfigs['INDEX'][ES_INVITES_TBL]      = array(
                                                      'invite_id' => array(
                                                                          'type' => 'unique',
                                                                          'cols' => 'invite_id'
                                                                          )
                                                      );                                                            
                                                            
$DBSchemaConfigs['PROPERTIES'][ES_PAGES_TBL] = array(
                                                    'page_id'     => array(
                                                                          'type'    => 'integer',
                                                                          'default' => 1,
                                                                          'require' => true
                                                                          ),
                                                    'title'      => array(
                                                                         'type'    => 'varchar',
                                                                         'size'    => 128,
                                                                         'require' => true
                                                                         ),
                                                    'lastedit'   => array(
                                                                         'type'    => 'timestamp'
                                                                         ),
                                                    'status'     => array(
                                                                         'type'    => 'varchar',
                                                                         'size'    => 13,
                                                                         'require' => true
                                                                         ),
                                                    'content'    => array(
                                                                         'type'    => 'clob'
                                                                         ),
                                                    'metadesc'   => array(
                                                                         'type'    => 'clob'
                                                                         ),
                                                    'metakeys'   => array(
                                                                         'type'    => 'clob'
                                                                         ),
                                                    'seourl'     => array(
                                                                         'type'    => 'varchar',
                                                                         'size'    => 128
                                                                         ),
                                                    'featured'   => array(
                                                                         'type'    => 'boolean',
                                                                         'require' => true,
                                                                         'default' => 0
                                                                         )
                                                    );
$DBSchemaConfigs['INDEX'][ES_PAGES_TBL]      = array(
                                                    'page_id' => array(
                                                                      'type' => 'unique',
                                                                      'cols' => 'page_id'
                                                                      )
                                                    );                                                                                     

$DBSchemaConfigs['PROPERTIES'][ES_APPS_TBL] = array(
                                                   'application_id'          => array(
                                                                                     'type'    => 'integer',
                                                                                     'default' => 1,
                                                                                     'require' => true
                                                                                     ),
                                                   'application_define_name' => array(
                                                                                     'type'    => 'varchar',
                                                                                     'size'    => 32,
                                                                                     'require' => true
                                                                                     )
                                                   );
$DBSchemaConfigs['INDEX'][ES_APPS_TBL]      = array(
                                                   'application_id'          => array(
                                                                                     'type' => 'unique',
                                                                                     'cols' => 'application_id'
                                                                                     ),
                                                   'application_define_name' => array(
                                                                                     'type' => 'unique',
                                                                                     'cols' => 'application_define_name'
                                                                                     )
                                                   );
                                                   
$DBSchemaConfigs['PROPERTIES'][ES_AREAS_TBL] = array(
                                                    'area_id'          => array(
                                                                               'type'    => 'integer',
                                                                               'default' => 1,
                                                                               'require' => true
                                                                                        ),
                                                    'application_id'   => array(
                                                                               'type'    => 'integer',
                                                                               'default' => 1,
                                                                               'require' => true
                                                                               ),
                                                    'area_define_name' => array(
                                                                               'type'    => 'varchar',
                                                                               'size'    => 255,
                                                                               'require' => true
                                                                               )
                                                    );
$DBSchemaConfigs['INDEX'][ES_AREAS_TBL]      = array(
                                                    'area_id'          => array(
                                                                               'type' => 'unique',
                                                                               'default' => 1,
                                                                               'cols' => 'area_id'
                                                                               ),
                                                    'area_define_name' => array(
                                                                               'type' => 'unique',
                                                                               'default' => 1,
                                                                               'cols' => array('application_id', 'area_define_name')
                                                                               )
                                                    );
                                                    
$DBSchemaConfigs['PROPERTIES'][ES_RIGHTS_TBL] = array(
                                                     'right_id'          => array(
                                                                                 'type'    => 'integer',
                                                                                 'default' => 1,
                                                                                 'require' => true
                                                                                 ),
                                                     'area_id'           => array(
                                                                                 'type'    => 'integer',
                                                                                 'default' => 1,
                                                                                 'require' => true
                                                                                 ),
                                                     'right_define_name' => array(
                                                                                 'type'    => 'varchar',
                                                                                 'size'    => 255
                                                                                 ),
                                                     'has_implied'       => array(
                                                                                 'type'    => 'varchar',
                                                                                 'default' => '\'N\'',
                                                                                 'size'    => 1,
                                                                                 'require' => true
                                                                                 )
                                                     );
$DBSchemaConfigs['INDEX'][ES_RIGHTS_TBL]      = array(
                                                     'right_id'          => array(
                                                                                 'type' => 'unique',
                                                                                 'cols' => 'right_id'
                                                                                 ),
                                                     'right_define_name' => array(
                                                                                 'type' => 'unique',
                                                                                 'cols' => array('area_id', 'right_define_name')
                                                                                 )
                                                     );                                                                                                       

$DBSchemaConfigs['PROPERTIES'][ES_PERMUSERS_TBL] = array(
                                                        'perm_user_id'        => array(
                                                                                      'type'    => 'integer',
                                                                                      'default' => 0,
                                                                                      'require' => true
                                                                                         ),
                                                        'auth_user_id'        => array(
                                                                                      'type'    => 'integer',
                                                                                      'default' => 0,
                                                                                      'require' => true
                                                                                      ),
                                                        'perm_type'           => array(
                                                                                      'type'    => 'integer',
                                                                                      ),
                                                        'auth_container_name' => array(
                                                                                      'type' => 'varchar',
                                                                                      'size' => 32
                                                                                      )
                                                        );
$DBSchemaConfigs['INDEX'][ES_PERMUSERS_TBL]      = array(
                                                        'perm_user_id'            => array(
                                                                                          'type' => 'unique',
                                                                                          'cols' => 'perm_user_id'
                                                                                          ),
                                                        'auth_user_container_rel' => array(
                                                                                          'type' => 'unique',
                                                                                          'cols' => array('auth_user_id', 'auth_container_name')
                                                                                          )
                                                        );
                                                        
$DBSchemaConfigs['PROPERTIES'][ES_GROUPS_TBL] = array(
                                                     'group_id'          => array(
                                                                                 'type'    => 'integer',
                                                                                 'default' => 0,
                                                                                 'require' => true
                                                                                 ),
                                                     'group_type'        => array(
                                                                                 'type'    => 'integer'
                                                                                 ),
                                                     'group_define_name' => array(
                                                                                 'type'    => 'varchar',
                                                                                 'size'    => 32,
                                                                                 'require' => true
                                                                                 ),
                                                     'owner_user_id'     => array(
                                                                                 'type'    => 'integer'
                                                                                 ),
                                                     'owner_group_id'    => array(
                                                                                 'type'    => 'integer'
                                                                                 ),
                                                     'is_active'         => array(
                                                                                 'type'    => 'varchar',
                                                                                 'default' => '\'Y\'',
                                                                                 'require' => true,
                                                                                 'size'    => 1
                                                                                 )
                                                     );
$DBSchemaConfigs['INDEX'][ES_GROUPS_TBL]      = array(
                                                     'group_id'          => array(
                                                                                 'type' => 'unique',
                                                                                 'cols' => 'group_id',
                                                                                 ),
                                                     'group_define_name' => array(
                                                                                 'type' => 'unique',
                                                                                 'cols' => 'group_define_name'
                                                                                 )
                                                     );
                                                     
$DBSchemaConfigs['PROPERTIES'][ES_GROUPUSERS_TBL] = array(
                                                         'perm_user_id' => array(
                                                                                'type'    => 'integer',
                                                                                'default' => 0,
                                                                                'require' => true
                                                                                ),
                                                         'group_id'     => array(
                                                                                'type'    => 'integer',
                                                                                'default' => 0,
                                                                                'require' => true
                                                                                )
                                                         );
$DBSchemaConfigs['INDEX'][ES_GROUPUSERS_TBL]      = array(
                                                         'perm_user_group_rel' => array(
                                                                                       'type' => 'unique',
                                                                                       'cols' => array('perm_user_id', 'group_id')
                                                                                       )
                                                         );

$DBSchemaConfigs['PROPERTIES'][ES_USERRIGHTS_TBL] = array(
                                                         'perm_user_id' => array(
                                                                                'type'    => 'integer',
                                                                                'default' => 0,
                                                                                'require' => true
                                                                                ),
                                                         'right_id'     => array(
                                                                                'type'    => 'integer',
                                                                                'default' => 0,
                                                                                'require' => true
                                                                                ),
                                                         'right_level'  => array(
                                                                                'type'    => 'integer',
                                                                                'default' => 0
                                                                                )
                                                         );
$DBSchemaConfigs['INDEX'][ES_USERRIGHTS_TBL]      = array(
                                                         'perm_user_right_rel' => array(
                                                                                       'type' => 'unique',
                                                                                       'cols' => array('perm_user_id', 'right_id')
                                                                                       )
                                                         );
                                                         
$DBSchemaConfigs['PROPERTIES'][ES_GROUPRIGHTS_TBL] = array(
                                                          'group_id'    => array(
                                                                                'type'    => 'integer',
                                                                                'default' => 1,
                                                                                'require' => true
                                                                                ),
                                                          'right_id'    => array(
                                                                                'type'    => 'integer',
                                                                                'default' => 1,
                                                                                'require' => true
                                                                                ),
                                                          'right_level' => array(
                                                                                'type'    => 'integer'
                                                                                )
                                                          );
$DBSchemaConfigs['INDEX'][ES_GROUPRIGHTS_TBL]      = array(
                                                          'group_right_rel' => array(
                                                                                    'type' => 'unique',
                                                                                    'cols' => array('group_id', 'right_id')
                                                                                    )
                                                          );                                                         

/*
$DBSchemaConfigs['PROPERTIES'][] = array();
$DBSchemaConfigs['INDEX'][]      = array();
*/
                                                    
?>